/**
 *   D12    D11    D10
 *nLED_4 nLED_2 nLED_1
 *  GPF6   GPF5   GPF4
 *GPFCON 0x56000050
 *GPFDAT 0x56000054
 *GPFUP  0x56000058
 *
 *GPFCON = 0x00001500:ALL
 *GPFCON = 0x00000100:GPF4
 *GPFCON = 0x00000400:GPF5
 *GPFCON = 0x00001000:GPF6
 */

#define GPFCON (*(volatile unsigned long *)0x56000050)
#define GPFDAT (*(volatile unsigned long *)0x56000054)

/**
 *	S3		S4		S5
 *	EINT0	EINT2	EINT11
 *  GPF0	GPF2	GPG3
 *GPFCON 0x56000050
 *GPFDAT 0x56000054
 *GPFUP  0x56000058
 *
 *GPGCON 0x56000060
 *GPGDAT 0x56000064
 *GPGUP  0x56000068
 */

#define GPGCON (*(volatile unsigned long *)0x56000060)
#define GPGDAT (*(volatile unsigned long *)0x56000064)

int main()
{
	unsigned long dwDat;

	GPFCON = 0x00001500;
	GPFDAT = 0x00000000;

	while (1) {
		dwDat = GPFDAT;

		if (dwDat & (1<<0))
			GPFDAT |= (1<<6);
		else
			GPFDAT &=~(1<<6);

		if (dwDat & (1<<2))
			GPFDAT |= (1<<5);
		else
			GPFDAT &=~(1<<5);

		dwDat = GPGDAT;

		if (dwDat & (1<<3))
			GPFDAT |= (1<<4);
		else
			GPFDAT &=~(1<<4);

		if (dwDat & (1<<11))
			GPFDAT |= ((1<<4) | (1<<5) | (1<<6));
		else
			GPFDAT &=~((1<<4) | (1<<5) | (1<<6));
	}

	return 0;
}

